Skip to content

feat: anonymous Kilo Code Gateway onboarding for new users#5415

Merged
markijbema merged 9 commits intomainfrom
mark/anonymous-kilocode-onboarding
Jan 28, 2026
Merged

feat: anonymous Kilo Code Gateway onboarding for new users#5415
markijbema merged 9 commits intomainfrom
mark/anonymous-kilocode-onboarding

Conversation

@markijbema
Copy link
Contributor

Summary

This PR implements anonymous Kilo Code Gateway onboarding, allowing new users to start using Kilo Code immediately without any configuration.

Changes

1. Remove token requirement in KiloCode handler

File: src/api/providers/kilocode-openrouter.ts

  • Changed from requiring both kilocodeToken AND openRouterBaseUrl to only requiring openRouterBaseUrl

2. Make auth header optional in default model fetching

File: src/api/providers/kilocode/getKilocodeDefaultModel.ts

  • Removed early return when no token
  • Made Authorization header conditional (only added when token exists)

3. Add kilocode to checkExistKey

File: src/shared/checkExistApiConfig.ts

  • Added "kilocode" to the list of providers that don't need additional configuration

4. Add migration in ProviderSettingsManager

File: src/core/config/ProviderSettingsManager.ts

  • Added kilocodeDefaultProfileMigrated to the migrations schema
  • Added migration logic in init_runMigrations()
  • Added new private method initializeKilocodeDefaultProfile() that:
    • Checks if ANY profile has a provider configured
    • If not, sets up default profile with apiProvider: "kilocode" and a free model
    • Uses fallback model google/gemma-2-9b-it:free if API fetch fails

Testing

  • All 43 tests in ProviderSettingsManager.spec.ts pass
  • Type checking passes
  • Linting passes

Plan Document

See docs/plans/anonymous-kilocode-onboarding.md for the detailed implementation plan.

@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

🦋 Changeset detected

Latest commit: ba97f46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@markijbema markijbema force-pushed the mark/anonymous-kilocode-onboarding branch 2 times, most recently from c94a5b5 to 0bbc541 Compare January 27, 2026 15:05
default: {
id: this.defaultConfigId,
apiProvider: "kilocode",
kilocodeModel: "google/gemma-2-9b-it:free",
Copy link
Collaborator

@chrarnoldus chrarnoldus Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trash (I saw this pop up while testing)

- Remove token requirement in kilocode-openrouter.ts fetchModel
- Make auth header optional in getKilocodeDefaultModel.ts
- Add kilocode to checkExistKey providers list
- Add migration to initialize default kilocode profile for new users
- Update ProviderSettingsManager tests for new migration behavior

Apply suggestion from @chrarnoldus

Co-authored-by: Christiaan Arnoldus <christiaan.arnoldus@outlook.com>

Add missing translations for loginForPremiumModels
remove line

remove comment

refactor: simplify anonymous kilocode onboarding to use default config instead of migration

- Remove kilocodeDefaultProfileMigrated migration flag
- Set apiProvider and kilocodeModel directly in defaultProviderProfiles
- Add isNewUser flag to load() to distinguish new vs existing users
- Remove initializeKilocodeDefaultProfile migration method
- Simplify test fixtures by removing migration-related additions

This approach minimizes changes for easier upstream merging.
@markijbema markijbema force-pushed the mark/anonymous-kilocode-onboarding branch from bf01f27 to 0cc09dc Compare January 27, 2026 20:47
@markijbema markijbema force-pushed the mark/anonymous-kilocode-onboarding branch 2 times, most recently from 6dc0c22 to 2e490fe Compare January 28, 2026 09:59
@markijbema markijbema marked this pull request as ready for review January 28, 2026 10:19
try {
const path = organizationId ? `/organizations/${organizationId}/defaults` : `/defaults`
const url = getKiloUrlFromToken(`https://api.kilo.ai/api${path}`, kilocodeToken)
const url = getKiloUrlFromToken(`https://api.kilo.ai/api${path}`, kilocodeToken ?? "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will not work properly, but whatever

): Promise<Defaults> {
const key = JSON.stringify({
kilocodeToken,
kilocodeToken: kilocodeToken ?? "anonymous",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kilocodeToken: kilocodeToken ?? "anonymous",
kilocodeToken,

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Jan 28, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR implements anonymous Kilo Code onboarding, allowing new users to start using Kilo Code immediately without any configuration. A default Kilo Code Gateway profile with a free model (minimax/minimax-m2.1:free) is automatically set up on first launch.

Key Changes:

  • Default provider profile now uses kilocode provider with a free model for new users
  • Anonymous access is allowed for the kilocode provider (no token required)
  • UI updated to show "Log in to access premium models & features" message for unauthenticated users
  • Validation updated to allow kilocode provider without API key
  • Tests updated to reflect new default behavior
  • Localization strings added for the new login prompt message

Implementation Quality:

  • Proper kilocode_change markers used throughout
  • Tests updated appropriately to verify new behavior
  • Error handling maintained (fallback to openRouterDefaultModelId on fetch failure)
  • Cache key uses "anonymous" string for unauthenticated users to avoid cache collisions
Files Reviewed (10 files)
  • .changeset/anonymous-kilocode-onboarding.md - Changeset for the feature
  • src/api/providers/kilocode-openrouter.ts - Removed token requirement check
  • src/api/providers/kilocode/getKilocodeDefaultModel.ts - Handle undefined token gracefully
  • src/core/config/ProviderSettingsManager.ts - Default profile with kilocode provider
  • src/core/config/__tests__/ProviderSettingsManager.spec.ts - Updated tests
  • src/shared/checkExistApiConfig.ts - Added kilocode to no-config-required providers
  • webview-ui/src/components/kilocode/settings/providers/KiloCode.tsx - UI for login prompt
  • webview-ui/src/utils/validate.ts - Allow kilocode without token
  • webview-ui/src/i18n/locales/*/kilocode.json - Localization strings (22 files)
  • pnpm-lock.yaml - Dependency updates (auto-generated)

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Jan 28, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR implements anonymous Kilo Code onboarding, enabling new users to start using Kilo Code immediately without any configuration. The implementation is clean and well-structured.

Key Changes:

  • Sets kilocode as the default provider with a free model (minimax/minimax-m2.1:free) for new users
  • Allows kilocode provider to work without authentication token
  • Updates UI to show login prompt for premium models/features
  • Adds translations for the new "login for premium models" message across all locales
  • Updates validation logic to not require token for kilocode provider

Implementation Quality:

  • New user detection logic in ProviderSettingsManager.ts is sound
  • Graceful handling of undefined tokens with null coalescing
  • Tests properly updated to reflect new behavior
  • Consistent kilocode_change markers for fork maintenance
Files Reviewed (28 files)
  • .changeset/anonymous-kilocode-onboarding.md
  • src/api/providers/kilocode-openrouter.ts
  • src/api/providers/kilocode/getKilocodeDefaultModel.ts
  • src/core/config/ProviderSettingsManager.ts
  • src/core/config/__tests__/ProviderSettingsManager.spec.ts
  • src/shared/checkExistApiConfig.ts
  • webview-ui/src/components/kilocode/settings/providers/KiloCode.tsx
  • webview-ui/src/utils/validate.ts
  • webview-ui/src/i18n/locales/*/kilocode.json (20 locale files)

@markijbema markijbema merged commit dedb8aa into main Jan 28, 2026
12 checks passed
@markijbema markijbema deleted the mark/anonymous-kilocode-onboarding branch January 28, 2026 10:33
markijbema added a commit that referenced this pull request Jan 29, 2026
- Revert automatic kilocode profile creation for new users
- Add 'Start with free models' button to welcome screen
- Implement startWithFreeModels message handler
- Update tests to reflect opt-in behavior
- Users must explicitly click button to enable free models

Reverts the auto-creation behavior from PR #5415 and adds
explicit opt-in via button click instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants